
import java.sql.Date;
import java.sql.ResultSet;
import java.sql.SQLException;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Patrick
 */
public class Event {
    private int id;
    private int typeId;
    private String description;
    private String name;
    private Date creationDate;
    private Date endingDate;
    private double longitude;
    private double latitude;
    private double distance;
    private double bearing;

    
    public Event(int typeId, String desc){
        this.typeId = typeId;
        this.description = desc;
    }
    public Event(ResultSet rs,double userLon, double userLat) throws SQLException{
        this.id = rs.getInt("id");
        this.typeId = rs.getInt("typeid");
        this.description = rs.getString("description");
        this.name = rs.getString("name");
        this.longitude = rs.getDouble("longitude");
        this.latitude = rs.getDouble("latitude");
        this.creationDate = rs.getDate("creationdate");
        this.endingDate = rs.getDate("endingdate");
        this.distance = GeoTools.distance(this.latitude, userLat, this.longitude, userLon, 0, 0);
        this.bearing = GeoTools.bearing(userLat, userLon, this.latitude, this.longitude);
    }
    /**
     * @return the creationDate
     */
    public Date getCreationDate() {
        return creationDate;
    }

    /**
     * @return the endingDate
     */
    public Date getEndingDate() {
        return endingDate;
    }

    /**
     * @return the longitude
     */
    public double getLongitude() {
        return longitude;
    }

    /**
     * @return the latitude
     */
    public double getLatitude() {
        return latitude;
    }

    /**
     * @return the distance
     */
    public double getDistance() {
        return distance;
    }

    /**
     * @return the bearing
     */
    public double getBearing() {
        return bearing;
    }

    /**
     * @return the id
     */
    public int getId() {
        return id;
    }

    /**
     * @return the typeId
     */
    public int getTypeId() {
        return typeId;
    }

    /**
     * @param typeId the typeId to set
     */
    public void setTypeId(int typeId) {
        this.typeId = typeId;
    }

    /**
     * @return the description
     */
    public String getDescription() {
        return description;
    }

    /**
     * @param description the description to set
     */
    public void setDescription(String description) {
        this.description = description;
    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }
}
